<template>
    <div>
        <van-field v-model="form.name" label='名字'/>
        <van-field v-model="form.type" label='参数'/>
        <van-button @click="add" color="linear-gradient(to right, #ff6034,#7232dd)">添加</van-button>
        <br><br><br><br><br><br>
        <table>
            <tr >
                <td>名称</td>
                <td>参数</td>
            </tr>
            <tr v-for="i in list">
                <td>{{i.name}}</td>
                <td>{{i.type}}</td>
            </tr>
        </table>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                list:[],
                form:{}
            }
        },
        methods:{
            get_list(){
                this.$axios.get('test').then(res=>{
                    this.list = res.data.list
                })
            },add(){
                this.$axios.post('test',this.form).then(res=>{
                    alert('添加成功')
                    this.get_list()
                })
            }
        
        },
        mounted(){
            this.get_list()
        }
    }
</script>

<style scoped>

</style>